package bite20220326;

class Student{
    private String name;
    private int age;
    private double score;
    public static String classes = "java104";

    {
        name = "bite";
        age = 18;
        score = 100.0;
    }//实例代码块优先于构造方法

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }
}

public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("zhangsan",18,222.0);
        Student student2 = new Student("wangwu",20,333.0);
        System.out.println(student1.classes);
        student1.classes = "java105";//不合理的修改方式
        Student.classes = "java105";//合理的修改方式
        System.out.println(student2.classes);
    }
}
